<html>

	<head>
		<title>RestQL</title>
		<style>
			h1 {
				color: grey;
				font-family: Verdana, Arial;
				font-size: 36px;
			}
			h2 {
				color: grey;
				font-family: Verdana;
				font-size: 24px;
			}
			h3 {
				color: grey;
				font-family: Verdana;
				font-size: 16px;
			}
			body {
				margin: 0px;
				padding: 12px;
				border: solid 12px grey;
				font-family: Verdana, Arial;
				font-size: 14px;
			}
			pre {
				margin-left: 24px;
			}
		</style>
	</head>
	<body>
		<h1>restQL</h1>
		<h2>Features</h2>
			<ul>
				<li>Operations</li>
				<ul>
					<li>GET for SELECT statements</li>
					<li>GET of DTD</li>
					<li>PUT for INSERT statements</li>
					<li>POST for UPDATE statements</li>
					<li>DELETE for DELETE statements</li>
				</ul>
				<li>Databases</li>
				<ul>
					<li>mysql on localhost</li>
				</ul>
			</ul>
		<h2>Getting Started</h2>
			Start by configuring your servlet on the <a href='config.jsp'>config page</a>.<br/>
			For more information, visit the google code homepage for the 
			<a href='http://code.google.com/p/restql/'>RestQL</a> project.
			
		<h2>Examples</h2>
			<h3>GET (SELECT)</h3>
			Suppose you have a database named "entertainment" with a table named "movies". If this table has fields
			id, title, releaseDate, you could do the following GET queries:
			<ol>
				<li> http://localhost:8080/restql/rest/entertainment/movies - Full list of rows in table </li>
				<li> http://localhost:8080/restql/rest/entertainment/movies.dtd - DTD of XML returned for #1. </li>
				<li> http://localhost:8080/restql/rest/entertainment/movies?title=Superbad - Return xml for Superbad entry </li>
				<li> http://localhost:8080/restql/rest/entertainment/movies?id=gt:5 - Return movies with id greater than 5. </li>
				<li> http://localhost:8080/restql/rest/entertainment/movies?rql:max=5 - Return at most 5 movies </li>
				<li> http://localhost:8080/restql/rest/entertainment/movies?rql:max=5&skip=2 Return at most 5 movies, skipping the first 2 results </li>
			</ol>
			<h3>PUT (INSERT)</h3>
			Inserts into database tables can be done through HTTP PUTs. Example:
			<pre>
PUT http://localhost:8080/restql/rest/entertainment/movies

&lt;entertainment&gt;
	&lt;movies&gt;
		&lt;title&gt;There Will Be Blood&lt;/title&gt;
		&lt;director&gt;PT Anderson&lt;/director&gt;
	&lt;/movies&gt;
&lt;/entertainment&gt;
			</pre>
			Will insert a row in the movies table with the given fields suppled.
			<h3>POST (UPDATE)</h3>
			Updates a database table using HTTP POST. Example:
			<pre>
POST http://localhost:8080/restql/rest/entertainment/movies?release_date=lt:2008-01-01

&lt;entertainment&gt;
	&lt;movies&gt;
		&lt;rating&gt;5&lt;/rating&gt;
	&lt;/movies&gt;
&lt;/entertainment&gt;
			</pre>
			Will set the rating to 5 for all movies released before 2008.
		<h3>DELETE (DELETE)</h3>
		Deletes from a database table using HTTP DELETE. Warning: Issuing a DELETE with
		no query parameters will delete all the contents of the table (but will not drop
		the table from the database). Example:
<pre>
DELETE http://localhost:8080/restql/rest/entertainment/movies?name=No%20Country%20For%20Old%20Men
</pre>
		Will delete the entry for No Country For Old Men from the database.
		<h2>Query Options</h2>
			<ul>
				<li>Special Query Keys</li>
				<ul>
					<li> ?rql:max - Max number of records to return </li>
					<li> ?rql:skip - Number of records to skip, used only with max </li>
				</ul>
				<li>Special Value prepends</li>
				<ul>
					<li> gt: - Greater than </li>
					<li> gte: - Greater than or equal to </li>
					<li> lt: - Less than </li>
					<li> lte: - Less than or equal to </li>
					<li> ne: - Not equal </li>
				</ul>
			</ul>
		<h2>Joins</h2>
		Create more complex queries by supplying your own configuration file, in Spring Bean 
		application context format. More documentation coming soon...
		<h2>Authorization</h2>
		By default, the RestQL servlet will try to connect to the specified database using user name root
		with a blank password. If this fails, a 401 response will be returned. If you are using a browser,
		you will be prompted for a user name and password. Supply your database username and password.
	</body>
</html>